package main

import (
	"encoding/json"
	"fmt"
)

type J1 struct {
	Company string   `json:"-"`        // json ignore
	Subject []string `json:"subjects"` // strut_tag的使用
	IsOk    bool     `json:",string"`  // 转成string输出
	Price   float64  `json:"price"`
}

func main_1() {
	str := `{
        "subjects": [
                "GO",
                "C++",
                "JAVA",
                "Python"
        ],
        "IsOk": "true",
        "price": 56.32
	}`

	it := new(J1)
	err := json.Unmarshal([]byte(str), it)
	if err != nil {
		fmt.Println("err = ", err)
		return
	}
	fmt.Println(*it)
}

func main() {
	str := `{
        "subjects": [
                "GO",
                "C++",
                "JAVA",
                "Python"
        ],
        "IsOk": "true",
        "price": 56.32
	}`

	type TT struct {
		IsOk bool `json:",string"`
	}

	tmp := new(TT)
	json.Unmarshal([]byte(str), tmp)
	fmt.Println(*tmp)

}
